//
//  OpenCLConvolutioner_mac.h
//  LowPassFilter_Standalone
//
//  Created by kadlubek47 on 02.05.2013.
//  Copyright (c) 2013 kadlubek47. All rights reserved.
//

#ifndef __LowPassFilter_Standalone__OpenCLConvolutioner_mac__
#define __LowPassFilter_Standalone__OpenCLConvolutioner_mac__

#include <OpenCL/opencl.h>

#include "GeneralExceptions.h"

#include "LPF_Types.h"
#include "ProcessInterface.h"

#include "convolute_kernel.cl.h"

// TODO: check sizeof

class OpenCLConvolutioner_mac: public ProcessInterface {
public:
    
    OpenCLConvolutioner_mac ();
    ~OpenCLConvolutioner_mac();
    
    void process(float_type* x, unsgn_integer_type x_size, float_type* h, unsgn_integer_type M, float_type* y);
    
    void printDeviceInfo();
    
private:

#pragma mark Initialization
    dispatch_queue_t queue;
    //
    void initialize();
    
#pragma mark Device buffers
    void* buffer_h_, *buffer_M_, *buffer_x_, *buffer_y_;
    bool buffersFirstTimeSet = false;
    unsgn_integer_type x_size_=0, M_=0, h_size_=0, y_size_=0;
    //
    void setSizeOfDeviceBuffers(unsgn_integer_type x_size, unsgn_integer_type M);
    
};

#endif /* defined(__LowPassFilter_Standalone__OpenCLConvolutioner_mac__) */
